﻿using System;
using System.Collections.Generic;
using System.Linq;


class MaxSumOfArray
{
    static void Main()
    {
        try
        {
            int countnumbers = int.Parse(Console.ReadLine());
            int numberK = int.Parse(Console.ReadLine());            
            int sum = 0;            
            int[] array = new int[countnumbers];
            List<int> sumArray = new List<int>();

            for (int i = 0; i < countnumbers; i++)
            {
                array[i] = int.Parse(Console.ReadLine());
            }

            for (int index = 0; index < countnumbers; index++)
            {
                if (array[index] == numberK)
                {                    
                    while (array[index] == numberK)
                    {
                        sum += array[index];
                        index++;
                        if (index == countnumbers)
                        {
                            break;
                        }
                    }
                    sumArray.Add(sum);
                    sum = 0;
                   
                }
            }
            sumArray.Sort();
            var count = sumArray.Count;
            Console.WriteLine(sumArray[count - 1]);
        }
        catch (Exception)
        {
            Console.WriteLine("Wrong Data!");
            return;
        }
    }
}